package com.gec.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.gec.model.system.ITripItinerary;
import com.gec.model.system.ITripService;
import com.gec.model.vo.ITripItineraryVo;
import com.gec.system.mapper.ITripItineraryMapper;
import com.gec.system.service.ITripItineraryService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * <p>
 * 出行方式表 服务实现类
 * </p>
 *
 * @author dafei
 * @since 2024-01-22
 */
@Service
public class ITripItineraryServiceImpl extends ServiceImpl<ITripItineraryMapper, ITripItinerary> implements ITripItineraryService {

    @Override
    public IPage<ITripItinerary> selectPage(IPage<ITripItinerary> page1, ITripItineraryVo iTripItineraryVo) {
        IPage<ITripItinerary> iPage = this.baseMapper.selectPage(page1,iTripItineraryVo,null) ;
        return iPage;
    }

    @Override
    public boolean isOverdue(Date startTime) {

        return startTime.after(new Date());
    }

    @Override
    public ITripItinerary selectByName(String typeNo) {
        QueryWrapper wrapper = new QueryWrapper();
        wrapper.eq("typeNo",typeNo);//相当于where typeNo=1
        List<ITripItinerary> list = baseMapper.selectList(wrapper);
        return list.size()==0 ?null :list.get(0);
    }


}
